#include <stdio.h>
#include <stdlib.h>


int main(int argc, char *argv[]) {

  int i, length, shift;
  scanf("%d %d", &length, &shift);

  int *array = (int *) malloc(sizeof(int) * length * 2);

  for (i = 0; i < length; i++) {
    scanf("%d", array + i);
  }

  for (i = length; i < length * 2; i++) {
    array[i] = array[i - length];
  }

  if (shift > length) {
    shift %= length;
  }

  for (i = 0; i < length; i++) {
    printf("%d", array[i + length - shift]);
    printf(i == length - 1 ? "\n" : " ");
  }

  free(array);

  return 0;
}
